<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增饲料库存')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-ncFeed-add">
			<input name="meterialId" type="hidden" id="treeId"/>
			<div class="form-group">
				<!--<label class="col-sm-3 control-label">饲料批次：</label>-->
				<div class="col-sm-8">
					<input id="feedCode" name="feedCode" class="form-control" type="hidden">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">辅饲料名称：</label>
				<div class="col-sm-8">
					<input name="meterialName" onclick="selectMeterialTree()" id="treeName" type="text" readonly="true" placeholder="请选择" class="form-control" required>


					<!--<input id="feedName" name="feedName" class="form-control" type="text">-->
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">数量(kg)：</label>
				<div class="col-sm-8">
					<input id="inputAmount" name="inputAmount" required class="form-control" type="number" step="0.1" min="0" onkeyup=" value=value.replace(/^((\d+\.\d*[1-9]\d{1}))$/,'')">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">生产厂家：</label>
				<div class="col-sm-8">
					<input id="factory" name="factory" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">
               <label class="col-sm-3 control-label">入库时间：</label>
               <div class="col-sm-8">
				   <input id="createTime" data-format="yyyy-MM-dd HH:mm:ss"  name="createTime" placeholder="请选择时间"  th:value="*{#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd HH:mm:ss')}" class="form-control" type="text" th:class="time-input" data-type="datetime" >

				  <!-- <input id="createTime" name="createTime" class="form-control" type="text">-->
               </div>
            </div>

			<div class="form-group">
				<label class="col-sm-3 control-label">保质期：</label>
				<div class="col-sm-8">
					<input id="validDate" data-format="yyyy-MM-dd HH:mm:ss"  name="validDate" placeholder="请选择时间"  th:value="*{#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd HH:mm:ss')}" class="form-control" type="text" th:class="time-input" data-type="datetime" >

					<!--<input id="validDate" name="validDate" class="form-control" type="text">-->
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">采购人：</label>
				<div class="col-sm-8">
					<input id="purchaser" name="purchaser" class="form-control" type="text" th:value="${userName}">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">经手人：</label>
				<div class="col-sm-8">
					<input id="createBy" name="createBy" class="form-control" type="text" th:value="${userName}">
				</div>
			</div>


			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<textarea id="remark" name="remark" class="form-control" type="text" rows="4"></textarea>
				</div>
			</div>
			<div class="form-group">
				<!--<label class="col-sm-3 control-label">饲料类型 1:主饲料 2：辅饲料：</label>-->
				<div class="col-sm-8">
					<input id="feedType" name="feedType" class="form-control" type="hidden">
				</div>
			</div>
			<div class="form-group">
				<!--<label class="col-sm-3 control-label">管理类型 1:鸡舍 2：牛舍：</label>-->
				<div class="col-sm-8">
					<input id="managerType" name="managerType" class="form-control" type="hidden">
				</div>
			</div>

			<!--<div class="form-group">
				<label class="col-sm-3 control-label">库存(kg)：</label>
				<div class="col-sm-8">
					<input id="stockAmout" name="stockAmout" class="form-control" type="text">
				</div>
			</div>-->
			<!--<div class="form-group">
				<label class="col-sm-3 control-label">单位：</label>
				<div class="col-sm-8">
					<input id="unit" name="unit" class="form-control" type="text">
				</div>
			</div>-->

		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "system/ncChickenFeed2"
		$("#form-ncFeed-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			},
			focusCleanup: true
		});

		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-ncFeed-add').serialize());
	        }
	    }

		//物资选择树
		function selectMeterialTree() {
			var treeId = $("#treeId").val();
			var meterialId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
			var url = ctx + "system/meterial/selectMeterialTree/" + meterialId;
			var options = {
				title: '物资选择',
				width: "380",
				url: url,
				callBack: doSubmit
			};
			$.modal.openOptions(options);
		}

		function doSubmit(index, layero) {
			var body = layer.getChildFrame('body', index);
			$("#treeId").val(body.find('#treeId').val());
			$("#treeName").val(body.find('#treeName').val());
			layer.close(index);
		}
	</script>
</body>
</html>
